import {
	defineStore
} from 'pinia'
import  requestApi  from '../utils/api.js'
export const useStore = defineStore("main", {
	state() {
		return {
			j_token:'',
			userInfo:{},
		// 当前页面展示的类型数据
			typeList: [],
			contentList:[]
		};
	},
	actions:{
		toast(title='',icon='none'){
			uni.showToast({
				title,
				icon
			})
		},
		async getTypeList(){
			const params = {
				type:'getType',
				id: this.userInfo._id
			}
			const res = await requestApi('jSign',params)
			console.log(res,'res-------');
				if(res.result.status==='S'){
					this.typeList  = res.result.data
				}
		}
	},
	 unistorage:true, // 开启后对 state 的数据读写都将持久化
});